package io.cloud.tec.ant_design_vue_pro.web;

import io.cloud.tec.ant_design_vue_pro.dto.LoginRespDTO;
import io.cloud.tec.ant_design_vue_pro.dto.NavDTO;
import io.cloud.tec.ant_design_vue_pro.dto.RoleDTO;
import io.cloud.tec.project.util.JsonUtils;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/user")
@Data
public class UserWeb {

    @GetMapping("info")
    LoginRespDTO info() {
        String info = "{\"id\":\"4291d7da9005377ec9aec4a71ea837f\",\"name\":\"天野远子\",\"username\":\"admin\",\"password\":\"\",\"avatar\":\"/avatar2.jpg\",\"status\":1,\"telephone\":\"\",\"lastLoginIp\":\"27.154.74.117\",\"lastLoginTime\":\"\",\"creatorId\":\"admin\",\"createTime\":\"\",\"merchantCode\":\"TLif2btpzg079h15bk\",\"deleted\":0,\"roleId\":\"admin\",\"role\":{}}";
        final LoginRespDTO loginRespDTO = JsonUtils.parseObject(info, LoginRespDTO.class);
        String role = "{\"id\":\"admin\",\"name\":\"管理员\",\"describe\":\"拥有所有权限\",\"status\":1,\"creatorId\":\"system\",\"createTime\":\"\",\"deleted\":0,\"permissions\":[{\"roleId\":\"admin\",\"permissionId\":\"dashboard\",\"permissionName\":\"仪表盘\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"exception\",\"permissionName\":\"异常页面权限\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"result\",\"permissionName\":\"结果权限\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"profile\",\"permissionName\":\"详细页权限\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"table\",\"permissionName\":\"表格权限\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"import\",\"describe\":\"导入\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"form\",\"permissionName\":\"表单权限\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"order\",\"permissionName\":\"订单管理\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"permission\",\"permissionName\":\"权限管理\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"role\",\"permissionName\":\"角色管理\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"table\",\"permissionName\":\"桌子管理\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"query\",\"describe\":\"查询\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null},{\"roleId\":\"admin\",\"permissionId\":\"user\",\"permissionName\":\"用户管理\",\"actionEntitySet\":[{\"action\":\"add\",\"describe\":\"新增\",\"defaultCheck\":false},{\"action\":\"import\",\"describe\":\"导入\",\"defaultCheck\":false},{\"action\":\"get\",\"describe\":\"详情\",\"defaultCheck\":false},{\"action\":\"update\",\"describe\":\"修改\",\"defaultCheck\":false},{\"action\":\"delete\",\"describe\":\"删除\",\"defaultCheck\":false},{\"action\":\"export\",\"describe\":\"导出\",\"defaultCheck\":false}],\"actionList\":null,\"dataAccess\":null}]}";
        final RoleDTO roleDTO = JsonUtils.parseObject(role, RoleDTO.class);
        loginRespDTO.setRole(roleDTO);
        return loginRespDTO;
    }

    @GetMapping("nav")
    List<NavDTO> nav() {
        String info = "[//dashboard{name:'dashboard',parentId:0,id:1,meta:{title:'menu.dashboard',icon:'dashboard',show:true},component:'RouteView',redirect:'/dashboard/workplace'},{name:'workplace',parentId:1,id:7,meta:{title:'menu.dashboard.monitor',show:true},component:'Workplace'},{name:'monitor',path:'https://www.baidu.com/',parentId:1,id:3,meta:{title:'menu.dashboard.workplace',target:'_blank',show:true}},{name:'Analysis',parentId:1,id:2,meta:{title:'menu.dashboard.analysis',show:true},component:'Analysis',path:'/dashboard/analysis'},//form{name:'form',parentId:0,id:10,meta:{icon:'form',title:'menu.form'},redirect:'/form/base-form',component:'RouteView'},{name:'basic-form',parentId:10,id:6,meta:{title:'menu.form.basic-form'},component:'BasicForm'},{name:'step-form',parentId:10,id:5,meta:{title:'menu.form.step-form'},component:'StepForm'},{name:'advanced-form',parentId:10,id:4,meta:{title:'menu.form.advanced-form'},component:'AdvanceForm'},//list{name:'list',parentId:0,id:10010,meta:{icon:'table',title:'menu.list',show:true},redirect:'/list/table-list',component:'RouteView'},{name:'table-list',parentId:10010,id:10011,path:'/list/table-list/:pageNo([1-9]\\\\d*)?',meta:{title:'menu.list.table-list',show:true},component:'TableList'},{name:'basic-list',parentId:10010,id:10012,meta:{title:'menu.list.basic-list',show:true},component:'StandardList'},{name:'card',parentId:10010,id:10013,meta:{title:'menu.list.card-list',show:true},component:'CardList'},{name:'search',parentId:10010,id:10014,meta:{title:'menu.list.search-list',show:true},redirect:'/list/search/article',component:'SearchLayout'},{name:'article',parentId:10014,id:10015,meta:{title:'menu.list.search-list.articles',show:true},component:'SearchArticles'},{name:'project',parentId:10014,id:10016,meta:{title:'menu.list.search-list.projects',show:true},component:'SearchProjects'},{name:'application',parentId:10014,id:10017,meta:{title:'menu.list.search-list.applications',show:true},component:'SearchApplications'},//profile{name:'profile',parentId:0,id:10018,meta:{title:'menu.profile',icon:'profile',show:true},redirect:'/profile/basic',component:'RouteView'},{name:'basic',parentId:10018,id:10019,meta:{title:'menu.profile.basic',show:true},component:'ProfileBasic'},{name:'advanced',parentId:10018,id:10020,meta:{title:'menu.profile.advanced',show:true},component:'ProfileAdvanced'},//result{name:'result',parentId:0,id:10021,meta:{title:'menu.result',icon:'check-circle-o',show:true},redirect:'/result/success',component:'PageView'},{name:'success',parentId:10021,id:10022,meta:{title:'menu.result.success',hiddenHeaderContent:true,show:true},component:'ResultSuccess'},{name:'fail',parentId:10021,id:10023,meta:{title:'menu.result.fail',hiddenHeaderContent:true,show:true},component:'ResultFail'},//Exception{name:'exception',parentId:0,id:10024,meta:{title:'menu.exception',icon:'warning',show:true},redirect:'/exception/403',component:'RouteView'},{name:'403',parentId:10024,id:10025,meta:{title:'menu.exception.not-permission',show:true},component:'Exception403'},{name:'404',parentId:10024,id:10026,meta:{title:'menu.exception.not-find',show:true},component:'Exception404'},{name:'500',parentId:10024,id:10027,meta:{title:'menu.exception.server-error',show:true},component:'Exception500'},//account{name:'account',parentId:0,id:10028,meta:{title:'menu.account',icon:'user',show:true},redirect:'/account/center',component:'RouteView'},{name:'center',parentId:10028,id:10029,meta:{title:'menu.account.center',show:true},component:'AccountCenter'},//特殊三级菜单{name:'settings',parentId:10028,id:10030,meta:{title:'menu.account.settings',hideHeader:true,hideChildren:true,show:true},redirect:'/account/settings/basic',component:'AccountSettings'},{name:'BasicSettings',path:'/account/settings/basic',parentId:10030,id:10031,meta:{title:'account.settings.menuMap.basic',show:false},component:'BasicSetting'},{name:'SecuritySettings',path:'/account/settings/security',parentId:10030,id:10032,meta:{title:'account.settings.menuMap.security',show:false},component:'SecuritySettings'},{name:'CustomSettings',path:'/account/settings/custom',parentId:10030,id:10033,meta:{title:'account.settings.menuMap.custom',show:false},component:'CustomSettings'},{name:'BindingSettings',path:'/account/settings/binding',parentId:10030,id:10034,meta:{title:'account.settings.menuMap.binding',show:false},component:'BindingSettings'},{name:'NotificationSettings',path:'/account/settings/notification',parentId:10030,id:10034,meta:{title:'account.settings.menuMap.notification',show:false},component:'NotificationSettings'}]";
        return JsonUtils.parseList(info, NavDTO.class);
    }
}
